/*
 * shellsort.c
 *
 *  Created on: 19/04/2013
 *      Author: dario
 */

#include "shellsort.h"

void shellsort(char** words, int arraysize) {
	int i, j, increment;
	char* temp;

	increment = arraysize / 2;
	while (increment > 0) {
		for (i = 0; i < arraysize; i++) {
			j = i;
			temp = words[i];
			while ((j >= increment) && (MyStrCmp(words[j - increment],temp)>0)) {
				words[j] = words[j - increment];
				j = j - increment;
			}
			words[j] = temp;
		}
		if (increment == 2)
			increment = 1;
		else
			increment = increment * 5 / 11;
	}

}
